//
//  DoOnViewController.swift
//  testRxSwift
//
//  Created by 火星人 on 2017/7/25.
//  Copyright © 2017年 火星人. All rights reserved.
//

import UIKit
import RxSwift

class DoOnViewController: BaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.view.addTapWithHandle { (tap) in
            
            let disBag = DisposeBag()
            
            Observable<String>.of("hello", "world", "china")
                .do(onNext: { (value) in
                    print("do onNext: \(value)")
                }, onError: { (error) in
                    print(error)
                }, onCompleted: { 
                    print("completed")
                }, onSubscribe: { 
                    print("onSubscribe")
                }, onSubscribed: { 
                    print("onSubscribed")
                }, onDispose: { 
                    print("onDispose")
                })
                .subscribe(onNext: { (value) in
                    print(value)
                })
                .disposed(by: disBag)
        }
    }

}
